1. Technology Field
The present invention generally relates to a data accessing method, and more particularly, to a data accessing method for a flash memory and a storage system and a controller using the same.
2. Description of Related Art
Along with the widespread of digital cameras, camera phones, and MP3 in recently years, the consumers' demand to storage media has increased drastically too. Flash memory is one of the most adaptable memories for such battery-powered portable products due to its characteristics such as data non-volatility, low power consumption, small volume, and non-mechanical structure. A memory card is a storage device which uses a NAND flash memory as its storage medium. Memory card has been broadly adopted for storing personal data due to its small volume, large storage capacity, and high portability. Thereby, flash memory has become one of the most focused electronic products in recent years.
Generally speaking, a flash memory in a flash memory storage system is divided into a plurality of physical blocks, and these physical blocks are grouped into a data area and a spare area. Physical blocks in the data area store valid data written by write commands, and physical blocks in the spare area are used for substituting the physical blocks in the data area when the write commands are executed. To be specific, when a flash memory storage system receives a write command from a host and is about to write data into a physical block in the data area, the flash memory storage system selects a physical block from the spare area and writes valid data stored in the physical block of the data area and the new data into the physical block selected from the spare area. After that, the flash memory storage system links the physical block containing the new data to the data area, and erases the original physical block in the data area and links it to the spare area.
In order to allow a host to access physical blocks used alternatively for storing data, a flash memory storage system provides logical blocks to the host for accessing data. To be specific, the flash memory storage system maintains a logical-physical block mapping table for recording the mappings between the logical blocks and the physical blocks in the data area. Meanwhile, when the flash memory storage system executes a write command and accordingly switches a physical block in the data area and a physical block in the spare area, the flash memory storage system updates the logical-physical block mapping table so that subsequently the host can access data correctly.
However, in the technique described above, if the host repeatedly requests the flash memory storage system to write small quantity of data into different logical blocks, the flash memory storage system has to execute foregoing operations such as selecting a physical block from the spare area, moving data, and erasing the physical block constantly. As a result, the flash memory storage system spends a lot of time on data moving and physical block erasing, and accordingly, the performance of the flash memory storage system is affected.